#include <gtk/gtk.h>


static void cb(GtkWidget *widget, gpointer data)
{
  g_print("%s\n", gtk_combo_box_text_get_active_text
	  (GTK_COMBO_BOX_TEXT(widget)));
}	  

int main(int argc, char *argv[])
{
  GtkWidget *window, *comboboxtext;

  
  gtk_init(&argc, &argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
  g_signal_connect_swapped(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);

  comboboxtext = gtk_combo_box_text_new();
  gtk_container_add(GTK_CONTAINER(window), comboboxtext);

  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(comboboxtext), "item1");
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(comboboxtext), "item2");
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(comboboxtext), "item3");

  gtk_combo_box_set_active(GTK_COMBO_BOX(comboboxtext), 0);
  g_signal_connect(comboboxtext, "changed", G_CALLBACK(cb), NULL);

  gtk_widget_show_all(window);
  gtk_main();
  return 0;
}
